/*
 * @Description: 
 * @Author: Zilu
 * @Date: 2021-11-03 16:23:35
 * @Version: 
 * @LastEditTime: 2021-11-03 16:27:40
 * @LastEditors: Zilu
 */
// summing.c  --根据用户键入的整数求和
#include <stdio.h>

int main(void)
{
    long num;
    long sum = 0L;  //初始化 sum 为 0
    int status;

    printf("Please enter an integer to be summed ");
    printf("(q to quit):");
    status = scanf("%ld", &num);
    while (status==1)     //while 循环开始
    {                       //块开始
        sum += num;
        printf("Please enter next integer(q to quit):");
        status = scanf("%ld", &num);
    }                       //块结束
    printf("Those integers sum to %ld.\n", sum);

    return 0;
}